package com.edeweiss.community.dao.daoImp;

import com.edeweiss.community.dao.FaultyDao;
import com.edeweiss.community.domain.Faulty;
import com.edeweiss.community.domain.Notice;
import com.edeweiss.community.web.utils.JDBCUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class FaultyDaoImp implements FaultyDao {
    public List<Faulty> showFaulty(){
        String sql = "select * from faculty";
        QueryRunner qr = new QueryRunner(JDBCUtils.getDataSource());
        try {
            List<Faulty> query = qr.query(sql,new BeanListHandler<Faulty>(Faulty.class));
            return query;
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return null;
        }
    }
}
